package com.acarter.scenemonitor.propertydescriptor.enums;
/**
 * <p>
 * Title
 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * Copyright (c) 2007
 * </p>
 * 
 * @author Andrew Carter
 * @version
 */


/**
 * Enumerates the permissible texture mipmap modes.
 * 
 * @author Andrew Carter
 */
public enum E_TextureMM {

	/** Mipmap option for no mipmap. */
	MM_NONE("MM_NONE", 0),

	/**
	 * Mipmap option to return the value of the texture element that is nearest to the center of the
	 * pixel being textured.
	 */
	MM_NEAREST("MM_NEAREST", 1),

	/**
	 * Mipmap option to return the weighted average of the four texture elements that are closest to
	 * the center of the pixel being textured.
	 */
	MM_LINEAR("MM_LINEAR", 2),

	/**
	 * Mipmap option that picks the mipmap that most closely matches the size of the pixel being
	 * textured and uses MM_NEAREST criteria.
	 */
	MM_NEAREST_NEAREST("MM_NEAREST_NEAREST", 3),

	/**
	 * Mipmap option that picks the mipmap most closely matches the size of the pixel being textured
	 * and uses MM_LINEAR criteria.
	 */
	MM_NEAREST_LINEAR("MM_NEAREST_LINEAR", 4),

	/**
	 * Mipmap option that picks the two mipmaps that most closely match the size of the pixel being
	 * textured and uses MM_NEAREST criteria.
	 */
	MM_LINEAR_NEAREST("MM_LINEAR_NEAREST", 5),

	/**
	 * Mipmap option that picks the two mipmaps that most closely match the size of the pixel being
	 * textured and uses MM_LINEAR criteria.
	 */
	MM_LINEAR_LINEAR("MM_LINEAR_LINEAR", 6);

	/** String representation of the enum value */
	private String name;

	/** Integer value of the enum value */
	private int value;

	/**
	 * Private constructor.
	 * 
	 * @param value String literal of the enum
	 */
	private E_TextureMM(String name, int value) {

		this.name = name;
		this.value = value;
	}

	/**
	 * Returns the enum constant matching the name string.
	 * 
	 * @param name string value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_TextureMM getConstant(String name) {

		for(E_TextureMM constant : E_TextureMM.values()) {

			if(constant.toString().compareToIgnoreCase(name) == 0)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the enum constant matching the type value.
	 * 
	 * @param type type value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_TextureMM getConstant(int type) {

		for(E_TextureMM constant : E_TextureMM.values()) {

			if(constant.getType() == type)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the string value of the constant.
	 */
	public String toString() {

		return name;
	}

	/**
	 * Returns the integer value of the constant.
	 * 
	 * @return
	 */
	public int getType() {

		return value;
	}
}
